#include <bits/stdc++.h>
using namespace std;

int a[100005];
vector<int> cnt;

int main()
{
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i ++)
    {
        scanf("%d", &a[i]);
    }
    sort(a + 1, a + 1 + n);

    int now = 0, last = a[1];
    for (int i = 1; i <= n; i ++)
    {
        if (a[i] == last) now ++;
        else
        {
            cnt.push_back(now);
            last = a[i], now = 1;
        }
    }
    cnt.push_back(now);

    int quit = 0, left = cnt[0];
    for (int i = 1; i < cnt.size(); i ++)
    {
        if (cnt[i] >= left)
        {
            quit += left;
            left = cnt[i];
        }
        else
        {
            quit += cnt[i];
        }
    }
    cout << n - quit << endl;
    return 0;
}
